package com.guigu.base.controller;

import com.guigu.base.entity.vo.DashboardVO;
import com.guigu.base.service.DashboardService;
import com.guigu.tms.result.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName:DashboardController
 * @Description://TODO
 * @Author:taoLong
 * @Date:2021/12/3:13:46 星期五
 * @email:2391611102@qq.com or 2391611102qq@gmail.com
 */
@RestController
@RequestMapping("/dashboard")
@Api(tags = "面板管理")
public class DashboardController {
    @Autowired
    private DashboardService dashboardService;

    /**
     * 基础数据面板
     *
     * @param dateCount 天数
     * @return
     */
    @ApiOperation("基础数据面板")
    @GetMapping("/getDashboard/{dateCount}")
    public R<DashboardVO> getDashboard(@PathVariable("dateCount") Integer dateCount) {
        if (null == dateCount || dateCount <= 7) {
            dateCount = 7;
        }
        R<DashboardVO> r = dashboardService.getDashboard(dateCount);
        return r;
    }

}
